<!DOCTYPE html>
<html>
<head>
<title>Download File From MySQL</title>
</head>

<body>

<?php

// Downloads selected file from upload table.

require_once 'config.php';

$query = "SELECT id, name, size FROM upload";
$result = mysql_query($query) or die('Error, query failed');
$x = "X";
if(mysql_num_rows($result) == 0)
{
	echo "You have no uploaded files <br> ";
}
else
{
	while(list($id, $name, $size) = mysql_fetch_array($result))
	{
	$size = $size / 1024;
	
?>
	<form style="width:100%"><a style="font-family:'Lao UI';color:red" href="download.php?id=<?php echo $id;?>"><?php echo $name;?></a><a style="font-family:'Lao UI';color:gray; text-decoration:none;float:right" href="delete.php?id=<?php echo $id;?>"><?php echo $x;?></a></form><div style="font-family:'lao UI'"><?php echo round($size,0); echo " KB";?></div><br>
<?php
	}
}
mysql_close($db_server);
?>
</body>
</html>